import Item from "../item/item.js";
import Goods from "../shop/goods/goods.js";





export default interface Ability {

}

/**物品持有者 */
export interface ItemHolder extends Ability {
	addItem(item: Item, num?: number): void;
	removeItem(item: Item, num?: number): void;
	hasItem(item: Item): boolean;
	itemCount(item: Item): number;
	get items(): Map<Item, number>;
}

/**购买者 */
export interface Purchaseable extends Ability {
	buy(goods: Goods, num?: number): void;
}

/**硬币持有者 */
export interface CoinHolder extends Ability {
	get coin(): number;
	set coin(value: number);
}

/**经验持有者 */
export interface ExpHolder extends Ability {
	get exp(): number;
	set exp(value: number);
}

/**名称持有者 */
export interface NameHolder extends Ability {
	get name(): string;
	set name(value: string);
}

/**等级持有者 */
export interface LevelHolder extends Ability {
	/**等级 */
	get level(): number;
	set level(value: number);
}

/**战斗所需数值持有者 */
export interface FightStatusHolder {
	/**生命值上限 */
	get maxHp(): number;
	/**当前生命值 */
	get currentHp(): number;
	set currentHp(value: number);
	/**攻击力 */
	get attackPower(): number;
	/**防御力 */
	get defensivePower(): number;
	/**敏捷度 */
	get agility(): number;

}



/**战斗者 */
export interface Fighter extends LevelHolder, NameHolder, FightStatusHolder {


	isAlive(): boolean;

	/**获取本次伤害值，不考虑闪避 */
	damageTo(target: Fighter): number;

	/**
	 * 对target造成伤害，不考虑闪避
	 */
	hurt(target: Fighter): void;

	/**复活 */
	reborn(): void;

	/**自杀 */
	suicide(): void;

	/**攻击，考虑闪避 */
	hit(target: Fighter);

	/**
	 * 是否闪避成功
	 * @param attacker 攻击者
	 */
	dodgeSuccess(attacker: FightStatusHolder): boolean;
	/**
	 * 闪避成功概率
	 * @param attacker 攻击者
	 * @returns  闪避成功概率，取值为0-1
	 */
	dodgeProbability(attacker: FightStatusHolder): number;
}